package com.ruoyi.factorydata.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.factorydata.domain.PurchaseOrderDetail;
import org.apache.ibatis.annotations.Param;

/**
 * 采购单详情Mapper接口
 *
 * @author ruoyi
 * @date 2025-07-17
 */
public interface PurchaseOrderDetailMapper extends BaseMapper<PurchaseOrderDetail> {
    /**
     * 查询采购单详情
     *
     * @param id 采购单详情主键
     * @return 采购单详情
     */
    public PurchaseOrderDetail selectPurchaseOrderDetailById(Long id);

    /**
     * 查询采购单详情列表
     *
     * @param purchaseOrderDetail 采购单详情
     * @return 采购单详情集合
     */
    public List<PurchaseOrderDetail> selectPurchaseOrderDetailList(PurchaseOrderDetail purchaseOrderDetail);

    /**
     * 新增采购单详情
     *
     * @param purchaseOrderDetail 采购单详情
     * @return 结果
     */
    public int insertPurchaseOrderDetail(PurchaseOrderDetail purchaseOrderDetail);

    /**
     * 修改采购单详情
     *
     * @param purchaseOrderDetail 采购单详情
     * @return 结果
     */
    public int updatePurchaseOrderDetail(PurchaseOrderDetail purchaseOrderDetail);

    /**
     * 删除采购单详情
     *
     * @param id 采购单详情主键
     * @return 结果
     */
    public int deletePurchaseOrderDetailById(Long id);

    /**
     * 批量删除采购单详情
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deletePurchaseOrderDetailByIds(Long[] ids);


    /**
     * 获取采购单的总采购数量
     * @param purchaseOrderId 采购单id
     */
    Integer getBuyNum(@Param("purchaseOrderId") Long purchaseOrderId);

    /**
     * 根据采购单id删除采购单详情
     * @param purchaseOrderId 采购单id
     */
    void removeByPurchaseOrderId(@Param("purchaseOrderId") Long purchaseOrderId);
}